Find the Largest and the Smallest

Puzzle. Find the largest and the smallest 4-digit numbers n such that when you erase the first two digits of n, you get the sum of the digits of n.

Share:Facebooktwitterredditpinterestlinkedinmail

8 Comments

  1. Konstantin:

    9927 and 1818

  2. eerk:

    9929, 1810

  3. Loretta Kelley:

    Very clever! Those values look right, but can you prove that they are the largest and smallest?

    a + b + c + d – 10c + d leads to the necessary condition that a + b = 9c

    This fits your numbers but I cannot go any further to eliminate smaller and larger four-digit numbers.

  4. Leo B.:

    9929 and 1810

  5. Antoine:

    Brute force is possible, using a small python program to browse through all numbers between 1000 and 9999.
    I get the same answer as Leo.

  6. buster:

    We have n = 1000a + 100b + 10c + d, where 0 <= b, c, d <= 9 and 1 <= a <= 9 (because n is a four-digit number), and a+b+c+d = 10c+d (the sum of all four digits is equal to the result of erasing the first two digits). From a+b+c+d = 10c+d, subtracting c+d from both sides, we get a+b = 9c. Since 1<=a<=9 and 0<=b<=9 we have 1<=a+b<=18, so the only possibilities for c are 1 (giving a+b=9) and 2 (giving a+b=18). In case c=1, where we have b=9-a, the largest possible n comes from choosing the largest possible a and d, namely a=d=9, and then b=9-a=0, so we get 9019. The smallest possible n comes from choosing the smallest possible a and d, namely a=1 and d=0, and then b=9-a=8, giving 1810. In case c=2, where we have a+b=19, both a and b must be 9. We only get to choose d, so the largest possible n in this case is 9929 and the smallest is 9920.

    So overall, as others have already said, the largest possible n is 9927 (with 9+9+2+7 = 27) and the smallest is 1810 (with 1+8+1+0 = 10).

  7. buster:

    Oops! *”where we have a+b=18″, not 19!

  8. buster:

    Oops again: *”the largest possible n is 9929 (with 9+9+2+9 = 29)”.

    (Moderator — would you care to fix those two mistakes in my original reply, to tidy things up?)

Leave a comment